#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

//class Solution
//{
//public:
//    string solve(string s, string t)
//    {
//        if (s == "0" || t == "0")
//        {
//            return 0;
//        }
//        int carry1 = 0;
//        int carry2 = 0;
//        string s1;
//        for (int i = s.length(); i >= 0; i--)
//        {
//            int temp1 = s[i] - '0';
//            for (int j = t.length(); i >= 0; i++)
//            {
//                int temp2 = t[j] - '0';
//                int val = temp1 * temp2 + carry1;
//                carry1 = val / 10;
//                val = val % 10;
//                
//            }
//        }
//    }
//};

class Solution
{
public:
    string solve(string s, string t)
    {
        if (s == "0" || t == "0")
        {
            return "0";
        }
        int m = s.size();
        int n = t.size();
        vector<int> pos(m + n, 0);
        for (int i = m - 1; i >= 0; i--)
        {
            for (int j = n - 1; j >= 0; j--)
            {
                int mul = (s[i] - '0') * (t[j] - '0');
                int p1 = i + j;
                int p2 = i + j + 1;
                int sum = mul + pos[p2];

                pos[p2] = sum % 10;
                pos[p1] += sum / 10;
            }
        }
        
        string result;
        for (int num : pos)
        {
            if (!(result.empty() && num == 0))
            {
                result.push_back(num + '0');
            }
        }

        return result.empty() ? "0" : result;
    }
};

int main(void)
{
    Solution s;
    string s1 = s.solve("9", "99999999999999999999999999999999999999999999999999999999999994");
    cout << s1 << endl;
	return 0;
}